<?php
require_once("../data/db_connection.php");
require_once("../constants.php");
require_once("../Utils.php");

$db = new db();

$user_id = getFinalValue($_POST[PARAM_USER_ID]);

$arr = array();
$sql = "SELECT * FROM pTableEventInfo WHERE _id in ( 
			SELECT pEventId FROM pTableUserEvent 
				WHERE pUserId = " . $user_id . " and pIfConfirmInvite = 1)";

if ($result = $db->query($sql)) {
	while($row = $result->fetch_assoc()){
		$arr[] = $row;
	}
}

$str = json_encode($arr);
echo json_encode($str);
?>
